Ahmet Mahmut Gokkaya
Blog Books
In [47]:
library(readxl)
library(ggplot2)
library(dplyr)
library(knitr)
library(tidyverse)
library(forecast)
library(vars)
library(gridExtra)
library(corrplot)
In [53]:
data = head(data, 56)

head(data)
A tibble: 6 × 35
DateCDS of Turkey (5yr)Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)USDTRYTurkey Average Deposit Rate (1m)Turkey Implied Yield (1-month, %)Turkey CPI (%YoY)Turkey 12-month ahead inflation expectationsAverage CDS of Emerging Markets (5yr)VIX⋯Turkey GDP Level (SWDA)Turkey GDP Growth (%YoY, NSA)Turkey 2yr Bond YieldTurkey 5yr Bond YieldTurkey 10yr Bond YieldTurkey Average Commercial Loan RateTurkey Average Consumer Loan RateTurkey CPI based REERTurkey Household Total FX Deposits (US$ bn)Turkey Corporates Total FX Deposits (US$ bn)
<dttm><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>⋯<dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>
2006-03-01143.96613.501.333014.3813.209 8.085.47 83.18012.04⋯ 96.886.4513.6713.15NA16.8117.26171.9043969.0117387.77
2006-06-01197.45913.831.463114.3914.159 9.605.98201.52514.53⋯ 99.839.3716.2416.14NA16.8417.57155.8043078.6917170.67
2006-09-01221.26117.501.498917.4818.61710.837.84153.06813.61⋯ 99.085.9619.9318.50NA19.8525.15151.4645564.8417500.41
2006-12-01182.81317.501.455417.8818.851 9.837.23120.58111.03⋯101.326.1621.3419.82NA20.2223.77157.9750029.4620544.16
2007-03-01168.76917.501.410917.8818.40810.326.81106.58712.56⋯103.168.2020.1219.12NA19.4323.00163.4255046.6122513.14
2007-06-01152.00517.501.338217.7018.336 9.526.58101.42013.73⋯103.203.2318.7317.50NA19.1921.32169.9960139.2124147.91
In [50]:
column_names <- colnames(data)
print(column_names)
 [1] "Date"                                                                                             
 [2] "CDS of Turkey (5yr)"                                                                              
 [3] "Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)"
 [4] "USDTRY"                                                                                           
 [5] "Turkey Average Deposit Rate (1m)"                                                                 
 [6] "Turkey Implied Yield (1-month, %)"                                                                
 [7] "Turkey CPI (%YoY)"                                                                                
 [8] "Turkey 12-month ahead inflation expectations"                                                     
 [9] "Average CDS of Emerging Markets (5yr)"                                                            
[10] "VIX"                                                                                              
[11] "10yr BAA Spread"                                                                                  
[12] "US 10yr Treasury Bond Yield"                                                                      
[13] "US 2yr Treasury Bond Yield"                                                                       
[14] "US Policy Rate"                                                                                   
[15] "US CPI (%YoY)"                                                                                    
[16] "Fed and ECB Balance Sheet Total Size (US$ bn)"                                                    
[17] "Current Account Balance"                                                                          
[18] "Identified Inflows"                                                                               
[19] "Financial Account Inflows"                                                                        
[20] "Foreign Direct Investment inflows"                                                                
[21] "Portfolio Inflows"                                                                                
[22] "Other Investment Net Inflows"                                                                     
[23] "Errors and Ommissions"                                                                            
[24] "Reserve Assets"                                                                                   
[25] "Turkey Nominal GDP (USD bn)"                                                                      
[26] "Turkey GDP Level  (SWDA)"                                                                         
[27] "Turkey GDP Growth (%YoY, NSA)"                                                                    
[28] "Turkey 2yr Bond Yield"                                                                            
[29] "Turkey 5yr Bond Yield"                                                                            
[30] "Turkey 10yr Bond Yield"                                                                           
[31] "Turkey Average Commercial Loan Rate"                                                              
[32] "Turkey Average Consumer Loan Rate"                                                                
[33] "Turkey CPI based REER"                                                                            
[34] "Turkey Household Total FX Deposits (US$ bn)"                                                      
[35] "Turkey Corporates Total FX Deposits (US$ bn)"                                                     

1. In order to come up with a reasonable policy rate estimate, you may follow several methods¶

a) Study the historical data of real policy rate (average, min, max, etc.) using

  • ex-post (using actual inflation)
  • ex-ante (using 12-month ahead inflation expectations)
In [6]:
# ex-post real policy rate
data$ExPostRealPolicyRate <- data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)` - data$`Turkey CPI (%YoY)`
# ex-ante real policy rate
data$ExAnteRealPolicyRate <- data$`Turkey 12-month ahead inflation expectations` - data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`
In [18]:
# statistics of ex-post 
exPostRealPolicyRateMean = mean(data$ExPostRealPolicyRate, na.rm = TRUE)
exPostRealPolicyRateMin = min(data$ExPostRealPolicyRate, na.rm = TRUE)
exPostRealPolicyRateMax = max(data$ExPostRealPolicyRate, na.rm = TRUE)

# statistics of ex-ante 
exAnteRealPolicyRateMean = mean(data$ExAnteRealPolicyRate, na.rm = TRUE)
exAnteRealPolicyRateMin = min(data$ExAnteRealPolicyRate, na.rm = TRUE)
exAnteRealPolicyRateMax = max(data$ExAnteRealPolicyRate, na.rm = TRUE)
print("Real Policy Rate Mean of Expost:")
print(exPostRealPolicyRateMean)
print("Real Policy Rate Min of Expost:")
print(exPostRealPolicyRateMin)
print("Real Policy Rate Max of Expost:")
print(exPostRealPolicyRateMax)

print("Real Policy Rate Mean of ExAnte:")
print(exAnteRealPolicyRateMean)
print("Real Policy Rate Min of ExAnte:")
print(exAnteRealPolicyRateMin)
print("Real Policy Rate Max of ExAnte:")
print(exAnteRealPolicyRateMax)
[1] "Real Policy Rate Mean of Expost:"
[1] -2.140441
[1] "Real Policy Rate Min of Expost:"
[1] -67.74
[1] "Real Policy Rate Max of Expost:"
[1] 10.28
[1] "Real Policy Rate Mean of ExAnte:"
[1] -1.968971
[1] "Real Policy Rate Min of ExAnte:"
[1] -11.13
[1] "Real Policy Rate Max of ExAnte:"
[1] 26.26
In [13]:
# PLOTTİNG

exAnteRealPolicyRate = data.frame(Statistic = c("Mean", "Min", "Max"),
                                   Value = c(exAnteRealPolicyRateMean, exAnteRealPolicyRateMin, exAnteRealPolicyRateMax),
                                   Method = "Ex-Ante")

exPostRealPolicyRate = data.frame(Statistic = c("Mean", "Min", "Max"),
                                   Value = c(exPostRealPolicyRateMean, exPostRealPolicyRateMin, exPostRealPolicyRateMax),
                                   Method = "Ex-Post")

combinedData = rbind(exAnteRealPolicyRate, exPostRealPolicyRate)

ggplot(combinedData, aes(x = Statistic, y = Value, fill = Method)) +
  geom_bar(stat = "identity", width = 0.5, position = position_dodge()) +
  labs(title = "Ex-Ante and Ex-Post Real Policy Rate",
       x = "Statistic",
       y = "Value",
       fill = "Method") +
  theme_minimal()

This will create a bar chart with six bars representing the mean, minimum, and maximum values of the ex-ante and ex-post real policy rates side by side. The different colors represent the two different methods of estimation: ex-ante (based on 12-month ahead inflation expectations) and ex-post (based on actual inflation).

Comments on the values¶

  • The ex-ante and ex-post values may differ, as ex-ante values are based on expectations and ex-post values are based on actual outcomes. This can reflect differences between expected and realized inflation, and how central banks adjust their policy rates accordingly.

  • The mean value for ex-ante and ex-post real policy rates $(-1.968971\ and -2.140441, respectively)$ represents the average of the rates based on the corresponding methods.

  • These values can provide insights into the average level of the real policy rate over time.

  • The minimum and maximum values for ex-ante and ex-post real policy rates represent the lowest and highest rates observed in the data, respectively. These values can provide insights into the variability and range of the real policy rate based on the different estimation methods.

  • Comparing the $ex-ante$ and $ex-post$ values can help assess the accuracy of inflation expectations and the effectiveness of monetary policy actions in responding to actual inflation outcomes. It may also provide insights into the dynamics of inflation and how central banks manage their policy rates in response to changing economic conditions.$

B) Study the relationship between the real interest rates of Turkey and USA¶

In [ ]:
data_subset = data[, c("Date", "Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)",
                        "US Policy Rate", "Turkey CPI (%YoY)", "US CPI (%YoY)")]

# real interest rates by subtracting inflation rates
data_subset$Turkey_Real_Rate = data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)` - data_subset$`Turkey CPI (%YoY)`/100
data_subset$US_Real_Rate = data_subset$`US Policy Rate` - data_subset$`US CPI (%YoY)`/100

# Plotting
ggplot(data_subset, aes(x = Date)) +
  geom_line(aes(y = Turkey_Real_Rate, color = "Turkey"), size = 1.2) +
  geom_line(aes(y = US_Real_Rate, color = "USA"), size = 1.2) +
  labs(title = "Real Interest Rates: Turkey vs. USA",
       x = "Date", y = "Real Interest Rate") +
  scale_color_manual(name = "Country", values = c(Turkey = "blue", USA = "red")) +
  theme_minimal()

Rplot.png

In [24]:
head(data_subset)
A tibble: 6 × 7
DateTurkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)US Policy RateTurkey CPI (%YoY)US CPI (%YoY)Turkey_Real_RateUS_Real_Rate
<dttm><dbl><dbl><dbl><dbl><dbl><dbl>
2006-03-0113.504.46 8.083.613.41924.424
2006-06-0113.834.91 9.604.013.73404.870
2006-09-0117.505.2510.833.317.39175.217
2006-12-0117.505.25 9.831.917.40175.231
2007-03-0117.505.2610.322.417.39685.236
2007-06-0117.505.25 9.522.717.40485.223
In [33]:
turkey_real_interest_rate = data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`
usa_real_interest_rate = data$`US Policy Rate`
In [34]:
turkey_real_interest_rate = ts(data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, frequency = 12)
usa_real_interest_rate = ts(data$`US Policy Rate`, frequency = 12)
In [37]:
# Combine the time series objects into a data frame
interest_rate_data = data.frame(Turkey = turkey_real_interest_rate, USA = usa_real_interest_rate)
na.omit(interest_rate_data)
interest_rate_data = na.omit(interest_rate_data)
A data.frame: 68 × 2
TurkeyUSA
<dbl><dbl>
113.504.46
213.834.91
317.505.25
417.505.25
517.505.26
617.505.25
717.425.07
816.254.50
915.333.18
1015.752.09
1116.751.94
1216.000.51
1311.670.18
14 9.250.18
15 7.750.16
16 6.580.12
17 6.500.13
18 7.000.19
19 7.000.19
20 6.830.19
21 6.310.16
22 6.260.09
23 5.960.08
24 6.840.07
25 8.220.10
26 9.230.15
27 7.020.14
28 5.680.16
29 5.570.14
30 5.120.12
⋮⋮⋮
39 8.660.14
40 8.780.16
41 8.980.36
42 8.500.37
43 7.980.40
44 7.980.45
4510.100.70
4611.800.95
4711.971.15
4812.171.20
4912.751.45
5014.821.74
5119.291.92
5224.002.22
5324.072.40
5424.342.40
5520.312.19
5614.041.64
5710.721.26
58 8.310.06
59 9.040.09
6014.040.09
6117.230.08
6219.000.07
6318.950.09
6415.920.08
6514.000.12
6614.000.77
6713.472.19
6810.323.65
In [39]:
var_model = VAR(interest_rate_data, p = 2)
summary(var_model)
VAR Estimation Results:
========================= 
Endogenous variables: Turkey, USA 
Deterministic variables: const 
Sample size: 66 
Log Likelihood: -134.977 
Roots of the characteristic polynomial:
0.833 0.833 0.8304 0.8304
Call:
VAR(y = interest_rate_data, p = 2)


Estimation results for equation Turkey: 
======================================= 
Turkey = Turkey.l1 + USA.l1 + Turkey.l2 + USA.l2 + const 

          Estimate Std. Error t value Pr(>|t|)    
Turkey.l1  1.50543    0.10498  14.340  < 2e-16 ***
USA.l1    -0.01817    0.50662  -0.036  0.97151    
Turkey.l2 -0.68337    0.10377  -6.586 1.19e-08 ***
USA.l2     0.27191    0.49128   0.553  0.58195    
const      1.75909    0.51402   3.422  0.00111 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Residual standard error: 1.501 on 61 degrees of freedom
Multiple R-Squared: 0.9174,	Adjusted R-squared: 0.912 
F-statistic: 169.5 on 4 and 61 DF,  p-value: < 2.2e-16 


Estimation results for equation USA: 
==================================== 
USA = Turkey.l1 + USA.l1 + Turkey.l2 + USA.l2 + const 

           Estimate Std. Error t value Pr(>|t|)    
Turkey.l1  0.006169   0.023194   0.266    0.791    
USA.l1     1.625962   0.111935  14.526  < 2e-16 ***
Turkey.l2 -0.001895   0.022927  -0.083    0.934    
USA.l2    -0.699313   0.108545  -6.443 2.08e-08 ***
const      0.035866   0.113569   0.316    0.753    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Residual standard error: 0.3317 on 61 degrees of freedom
Multiple R-Squared: 0.9566,	Adjusted R-squared: 0.9538 
F-statistic: 336.3 on 4 and 61 DF,  p-value: < 2.2e-16 



Covariance matrix of residuals:
        Turkey     USA
Turkey 2.25344 0.08996
USA    0.08996 0.11000

Correlation matrix of residuals:
       Turkey    USA
Turkey 1.0000 0.1807
USA    0.1807 1.0000

The residual standard errors for both equations are also provided, which indicate the average residual standard deviation of the model's predictions. The multiple R-squared and adjusted $R-squared$ values provide information on the overall goodness-of-fit of the model, with higher values indicating better fit. The $F-statistic$ and its associated $p-value$ test the overall significance of the model, with lower $p-values$ indicating that the model is statistically significant. Finally, the covariance matrix of residuals and the correlation matrix of residuals provide information on the estimated covariance and correlation among the residuals of the variables, respectively.

$$USA$$

The coefficient estimate for the lag 1 of $USA$ is $1.625962$ with a standard error of $0.111935$. The $p-value$ is very small (less than 0.001), indicating that the coefficient is statistically significant at conventional significance levels

The coefficient estimate for the lag $2$ of Turkey is $-0.001895$ with a standard error of $0.022927$. The p-value is not statistically significant $(p > 0.05)$, indicating that the coefficient is not statistically different from $zero$.

$$TURKEY$$

the coefficient estimate for the lag $2$ of $USA$ is $0.27191$ with a standard error of $0.49128$. The p-value is not statistically significant $(p > 0.05)$, indicating that the coefficient is not statistically different from $zero$.

The coefficient estimate for the lag $1$ of $USA$ is $-0.01817$ with a standard error of $0.50662$. The p-value is not statistically significant $(p > 0.05)$, indicating that the coefficient is not statistically different from $zero$.

In [40]:
plot(var_model)
In [ ]:
var_model$varresult$coefficients
In [42]:
# variables to shocks
irf <- irf(var_model, impulse = "Turkey", response = "USA", n.ahead = 10)
In [44]:
irf
Impulse response coefficients
$Turkey
             USA
 [1,] 0.05992674
 [2,] 0.10669869
 [3,] 0.14266912
 [4,] 0.16781453
 [5,] 0.18138819
 [6,] 0.18309353
 [7,] 0.17368559
 [8,] 0.15505883
 [9,] 0.12996824
[10,] 0.10156111
[11,] 0.07288082


Lower Band, CI= 0.95 
$Turkey
               USA
 [1,]  0.006483447
 [2,] -0.004159124
 [3,] -0.043013973
 [4,] -0.083595360
 [5,] -0.107407283
 [6,] -0.161020411
 [7,] -0.210671056
 [8,] -0.238149197
 [9,] -0.275074622
[10,] -0.265454550
[11,] -0.254928059


Upper Band, CI= 0.95 
$Turkey
            USA
 [1,] 0.1388045
 [2,] 0.2546378
 [3,] 0.3287335
 [4,] 0.4046357
 [5,] 0.4629494
 [6,] 0.4942153
 [7,] 0.5338276
 [8,] 0.5085126
 [9,] 0.4813156
[10,] 0.4356660
[11,] 0.3464817
In [46]:
forecast = predict(var_model, n.ahead = 10)
forecast
$Turkey
           fcst    lower    upper       CI
 [1,]  8.619309 5.677120 11.56150 2.942190
 [2,]  8.593627 3.277980 13.90927 5.315647
 [3,]  9.936308 2.851207 17.02141 7.085101
 [4,] 12.063086 3.875787 20.25039 8.187299
 [5,] 14.337633 5.566131 23.10913 8.771502
 [6,] 16.233375 7.163725 25.30302 9.069650
 [7,] 17.420316 8.139896 26.70074 9.280420
 [8,] 17.783653 8.282171 27.28513 9.501482
 [9,] 17.392031 7.657028 27.12704 9.735004
[10,] 16.437449 6.495823 26.37908 9.941626

$USA
          fcst      lower    upper        CI
 [1,] 4.477265  3.8272041 5.127325 0.6500605
 [2,] 4.796848  3.5530499 6.040646 1.2437983
 [3,] 4.741027  2.9604106 6.521643 1.7806162
 [4,] 4.435106  2.2088497 6.661362 2.2262562
 [5,] 3.987301  1.4147028 6.559900 2.5725983
 [6,] 3.483122  0.6567845 6.309460 2.8263377
 [7,] 2.983885 -0.0177726 5.985543 3.0016579
 [8,] 2.528453 -0.5869822 5.643887 3.1154347
 [9,] 2.137051 -1.0471369 5.321238 3.1841875
[10,] 1.816031 -1.4062738 5.038337 3.2223053
$$Turkey$$
  • Forecast (fcst): 8.619309
  • Lower confidence interval (lower): 5.677120
  • Upper confidence interval (upper): 11.56150
  • Confidence interval (CI): 2.942190
$$USA$$
  • Forecast (fcst): 4.477265
  • Lower confidence interval (lower): 3.8272041
  • Upper confidence interval (upper): 5.127325
  • Confidence interval (CI): 0.6500605

C) Study the relationship between policy rate and other key interest rates such as¶

  • 1. Deposit rates
  • 2. Swap rates
In [63]:
# Subset the data to relevant columns
data_subset = head(data, 56)[, c("Date", "Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)",
                        "Turkey Average Deposit Rate (1m)", "Turkey Implied Yield (1-month, %)", "Turkey 2yr Bond Yield",
                        "Turkey 5yr Bond Yield", "Turkey 10yr Bond Yield")]
In [64]:
#data_subset = data_subset[complete.cases(data_subset), ]
data_subset
A tibble: 56 × 7
DateTurkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)Turkey Average Deposit Rate (1m)Turkey Implied Yield (1-month, %)Turkey 2yr Bond YieldTurkey 5yr Bond YieldTurkey 10yr Bond Yield
<dttm><dbl><dbl><dbl><dbl><dbl><dbl>
2006-03-0113.5014.3813.20913.6713.15 NA
2006-06-0113.8314.3914.15916.2416.14 NA
2006-09-0117.5017.4818.61719.9318.50 NA
2006-12-0117.5017.8818.85121.3419.82 NA
2007-03-0117.5017.8818.40820.1219.12 NA
2007-06-0117.5017.7018.33618.7317.50 NA
2007-09-0117.4217.4418.00817.7517.32 NA
2007-12-0116.2516.5616.48716.4416.09 NA
2008-03-0115.3315.8615.55217.0117.59 NA
2008-06-0115.7516.1816.50919.9520.28 NA
2008-09-0116.7517.0617.06919.7219.64 NA
2008-12-0116.0017.7016.45120.5022.06 NA
2009-03-0111.6713.1612.50815.1616.69 NA
2009-06-01 9.2510.63 9.39912.4713.96 NA
2009-09-01 7.75 9.38 7.87810.2611.79 NA
2009-12-01 6.58 7.61 6.542 8.7610.21 NA
2010-03-01 6.50 7.42 6.340 8.9210.4510.66
2010-06-01 7.00 7.68 6.276 9.06 9.9810.52
2010-09-01 7.00 7.52 6.514 8.24 8.95 9.14
2010-12-01 6.83 7.26 5.909 7.61 8.29 8.72
2011-03-01 6.31 6.73 5.589 8.25 9.01 9.38
2011-06-01 6.26 6.89 6.576 8.77 9.31 9.46
2011-09-01 5.96 7.00 6.502 8.40 9.00 9.39
2011-12-01 6.84 7.70 7.859 9.89 9.96 9.80
2012-03-01 8.22 8.84 8.754 9.79 9.78 9.70
2012-06-01 9.23 9.06 8.895 9.31 9.24 9.28
2012-09-01 7.02 8.21 5.976 7.71 8.02 8.35
2012-12-01 5.68 6.85 4.828 6.57 6.92 7.46
2013-03-01 5.57 6.06 4.798 5.92 6.40 6.90
2013-06-01 5.12 5.43 4.581 5.93 6.58 6.92
2013-09-01 6.05 6.55 6.845 8.94 9.10 9.33
2013-12-01 6.55 6.84 6.819 8.75 9.03 9.29
2014-03-01 9.22 8.6310.21510.8010.6710.43
2014-06-01 9.79 9.29 9.271 9.12 9.22 9.45
2014-09-01 8.40 8.10 8.090 8.92 8.99 9.21
2014-12-01 8.40 8.26 8.443 8.46 8.44 8.58
2015-03-01 7.99 8.55 9.062 8.04 7.70 7.81
2015-06-01 8.26 9.0310.526 9.71 9.15 9.14
2015-09-01 8.66 9.4310.94110.5510.2910.05
2015-12-01 8.78 9.7410.73210.5910.5110.25
2016-03-01 8.98 9.9410.74710.8610.7210.68
2016-06-01 8.50 9.66 9.886 9.37 9.53 9.68
2016-09-01 7.98 9.04 8.466 8.78 9.43 9.63
2016-12-01 7.98 8.85 8.274 9.9110.4810.68
2017-03-0110.10 8.8110.52211.3011.2511.11
2017-06-0111.8010.1511.38411.2710.8710.63
2017-09-0111.9710.8611.62311.5910.9310.71
2017-12-0112.1711.1712.02213.1412.5511.98
2018-03-0112.7511.3912.36213.4112.6312.13
2018-06-0114.8212.7014.79616.5215.2514.38
2018-09-0119.2917.5321.95424.1022.7419.46
2018-12-0124.0022.0923.98022.6519.5517.73
2019-03-0124.0719.5825.75018.7917.0315.76
2019-06-0124.3421.4425.14722.5121.7518.60
2019-09-0120.3117.8717.58616.1916.0715.78
2019-12-0114.0411.6512.39412.6013.0113.03
In [65]:
# Ploting
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, y = `Turkey Average Deposit Rate (1m)`)) +
  geom_point(size = 3, color = "blue") +
  labs(title = "Policy Rate vs. Average Deposit Rate",
       x = "Policy Rate", y = "Average Deposit Rate") +
  theme_minimal()
In [66]:
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, y = `Turkey Implied Yield (1-month, %)`)) +
  geom_point(size = 3, color = "red") +
  labs(title = "Policy Rate vs. Implied Yield",
       x = "Policy Rate", y = "Implied Yield") +
  theme_minimal()
In [67]:
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, y = `Turkey 2yr Bond Yield`)) +
  geom_point(size = 3, color = "green") +
  labs(title = "Policy Rate vs. 2-year Bond Yield",
       x = "Policy Rate", y = "2-year Bond Yield") +
  theme_minimal()
In [68]:
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, y = `Turkey 5yr Bond Yield`)) +
  geom_point(size = 3, color = "purple") +
  labs(title = "Policy Rate vs. 5-year Bond Yield",
       x = "Policy Rate", y = "5-year Bond Yield") +
  theme_minimal()
In [ ]:
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, y = `Turkey 10yr Bond Yield`)) +
  geom_point(size = 3, color = "orange") +
  labs(title = "Policy Rate vs. 10-year Bond Yield",
       x = "Policy Rate", y = "10-year Bond Yield") +
  theme_minimal()

535dc234-3443-4898-badb-9f3ccbb10f39.png

D) Any other method¶

In [60]:
# correlations
correlation_deposit = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, data_subset$`Turkey Average Deposit Rate (1m)`)
correlation_yield = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, data_subset$`Turkey Implied Yield (1-month, %)`)
correlation_2yr = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, data_subset$`Turkey 2yr Bond Yield`)
correlation_5yr = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, data_subset$`Turkey 5yr Bond Yield`)
correlation_10yr = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, data_subset$`Turkey 10yr Bond Yield`)
In [63]:
correlation_table = data.frame(Key_Interest_Rate = c("Average Deposit Rate", "Implied Yield", "2-year Bond Yield", "5-year Bond Yield", "10-year Bond Yield"),
                                Correlation = c(correlation_deposit, correlation_yield, correlation_2yr, correlation_5yr, correlation_10yr))
# Print
kable(correlation_table, col.names = c("Key Interest Rate", "Correlation"))

|Key Interest Rate    | Correlation|
|:--------------------|-----------:|
|Average Deposit Rate |   0.9627876|
|Implied Yield        |   0.6916735|
|2-year Bond Yield    |   0.8742255|
|5-year Bond Yield    |   0.8134219|
|10-year Bond Yield   |   0.7884227|

These correlations represent the strength and direction of the linear relationship between the policy rate and the respective variables. A $correlation$ value of $1$ indicates a perfect positive linear relationship, $-1$ indicates a perfect negative linear relationship, and $0$ indicates no linear relationship.

E) Based on analysis, where do we think the policy rate should be set ?¶

In [64]:
# policy rate and deposit rate
plot(data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`, data$`Turkey Average Deposit Rate (1m)`,
     xlab = "Policy Rate",
     ylab = "Deposit Rate",
     main = "Scatter Plot: Policy Rate vs. Deposit Rate")
In [65]:
# Linear regression between policy rate and yield
model = lm(`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)` ~ `Turkey Implied Yield (1-month, %)`, data = data)
summary(model)
Call:
lm(formula = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)` ~ 
    `Turkey Implied Yield (1-month, %)`, data = data)

Residuals:
     Min       1Q   Median       3Q      Max 
-10.4038  -1.9149  -0.7269   2.6776   7.4151 

Coefficients:
                                    Estimate Std. Error t value Pr(>|t|)    
(Intercept)                          5.51529    0.88967   6.199 4.18e-08 ***
`Turkey Implied Yield (1-month, %)`  0.46162    0.05694   8.108 1.70e-11 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 3.563 on 66 degrees of freedom
  (20 observations deleted due to missingness)
Multiple R-squared:  0.499,	Adjusted R-squared:  0.4914 
F-statistic: 65.74 on 1 and 66 DF,  p-value: 1.698e-11

According to analysis, the coefficient estimate for Turkey Implied Yield (1-month, %) is positive and statistically significant (p-value < 0.001). This indicates that there is a positive linear relationship between the Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate, and ON borrowing rate) and Turkey Implied Yield (1-month, %). As Turkey Implied Yield (1-month, %) increases, the Turkey Policy Rate is expected to increase as well.Therefore, based on the results of the linear regression analysis, it suggests that the policy rate should be set higher when Turkey Implied Yield (1-month, %) is higher, and vice versa. However, it is important to consider other factors and variables that may influence the policy rate decision, such as inflation, economic growth, monetary policy goals, and external factors,before making any final decision on setting the policy rate. It is always recommended to consult with economic experts and policymakers for a comprehensive and informed decision-making process.

2. Then you have a strong belief that following implementation of your suggestions, risk premium (i.e., 5yr CDS) may change in the next one year. You study 5yr CDS data (you may use regression with breaks) and conclude that the CDS may drop (or rise) by X basis points in a year. What is X in your opinion? Why do you think this could be the case? Explain in a few sentences¶

In [66]:
# Rename the column names to remove special characters and spaces
colnames(data) = c("Date", "CDS_Turkey_5yr", "Turkey_Policy_Rate", "USDTRY", "Turkey_Average_Deposit_Rate", "Turkey_Implied_Yield", "Turkey_CPI_YoY", "Turkey_12m_Inflation_Expectations", "Average_CDS_Emerging_Markets_5yr", "VIX", "BAA_Spread_10yr", "US_10yr_Treasury_Bond_Yield", "US_2yr_Treasury_Bond_Yield", "US_Policy_Rate", "US_CPI_YoY", "Fed_ECB_Balance_Sheet_Total_Size", "Current_Account_Balance", "Identified_Inflows", "Financial_Account_Inflows", "FDI_Inflows", "Portfolio_Inflows", "Other_Investment_Net_Inflows", "Errors_Omissions", "Reserve_Assets", "Turkey_Nominal_GDP", "Turkey_GDP_Level", "Turkey_GDP_Growth_YoY", "Turkey_2yr_Bond_Yield", "Turkey_5yr_Bond_Yield", "Turkey_10yr_Bond_Yield", "Turkey_Average_Commercial_Loan_Rate", "Turkey_Average_Consumer_Loan_Rate", "Turkey_CPI_REER", "Turkey_Household_FX_Deposits", "Turkey_Corporates_FX_Deposits")
In [67]:
# Perform linear regression
reg_model = lm(CDS_Turkey_5yr ~ Turkey_Policy_Rate, data = data)
In [68]:
#summary of the regression model
summary(reg_model)
Call:
lm(formula = CDS_Turkey_5yr ~ Turkey_Policy_Rate, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-188.33  -73.46  -24.00   30.32  480.70 

Coefficients:
                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)         162.097     41.157   3.939   0.0002 ***
Turkey_Policy_Rate   10.185      3.211   3.172   0.0023 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 131.3 on 66 degrees of freedom
  (20 observations deleted due to missingness)
Multiple R-squared:  0.1323,	Adjusted R-squared:  0.1192 
F-statistic: 10.06 on 1 and 66 DF,  p-value: 0.002296

Based on the results of the linear regression analysis, the coefficient estimate for the "Turkey_Policy_Rate" variable is positive (10.185) with a statistically significant p-value (0.0023), indicating that there may be a positive relationship between the "Turkey_Policy_Rate" and the "CDS of Turkey (5yr)".However, it's important to note that the R-squared value is relatively low (0.1323), which means that only about 13.23% of the variability in the "CDS of Turkey (5yr)" can be explained by the "Turkey_Policy_Rate" alone. This suggests that other factors not included in the model may also be influencing the "CDS of Turkey (5yr)".Based on the coefficient estimate of 10.185 for the "Turkey_Policy_Rate" variable from the linear regression analysis, and assuming all other factors remain constant, a one-unit increase in the "Turkey_Policy_Rate" would be associated with an estimated increase of 10.185 units in the "CDS of Turkey (5yr)". Similarly, a one-unit decrease in the "Turkey_Policy_Rate" would be associated with an estimated decrease of 10.185 units in the "CDS of Turkey (5yr)".However, it's important to note that this relationship is based solely on the results of the linear regression analysis and may not necessarily reflect the actual behavior of the "CDS of Turkey (5yr)" in reality. There may be other factors at play that are not accounted for in the model, and the relationship may be subject to change over time. It's always recommended to interpret the results of any statistical analysis with caution and consider other relevant factors before making any definitive conclusions about the direction or magnitude of change in a particular variable.

ARIMA METHOD¶

In [69]:
data$Date = as.Date(data$Date)
In [70]:
data_subset = data[, c("Date", "CDS_Turkey_5yr")]  # Update column name
In [71]:
data_subset = na.omit(data_subset)
In [72]:
cds_ts = ts(data_subset$CDS_Turkey_5yr, frequency = 12, start = c(year(min(data_subset$Date)), month(min(data_subset$Date))))
In [73]:
arima_model = auto.arima(cds_ts)
In [74]:
cds_forecast = forecast(arima_model, h = 12)  # h = 12 for 1 year ahead forecast
In [75]:
print(cds_forecast)
         Point Forecast    Lo 80    Hi 80    Lo 95     Hi 95
Nov 2011         611.75 522.8208 700.6792 475.7446  747.7554
Dec 2011         611.75 485.9852 737.5148 419.4093  804.0907
Jan 2012         611.75 457.7201 765.7799 376.1817  847.3183
Feb 2012         611.75 433.8916 789.6084 339.7391  883.7609
Mar 2012         611.75 412.8983 810.6017 307.6326  915.8674
Apr 2012         611.75 393.9189 829.5811 278.6061  944.8939
May 2012         611.75 376.4655 847.0345 251.9134  971.5866
Jun 2012         611.75 360.2203 863.2797 227.0685  996.4315
Jul 2012         611.75 344.9625 878.5375 203.7337 1019.7663
Aug 2012         611.75 330.5313 892.9687 181.6630 1041.8370
Sep 2012         611.75 316.8053 906.6947 160.6710 1062.8290
Oct 2012         611.75 303.6903 919.8097 140.6133 1082.8867

The cds_forecast object contains the point forecasts (i.e., the expected values) for the CDS_Turkey_5yr time series for each forecasted time period, as well as the lower and upper bounds of the forecast intervals at 80% and 95% confidence levels. For example, the forecasted point estimate for November 2011 is 611.75, with a lower bound of 522.8208 and an upper bound of 700.6792 at the 80% confidence level. Similarly, at the 95% confidence level, the lower bound is 475.7446 and the upper bound is 747.7554.The forecasted values continue for each subsequent time period (December 2011 to October 2012) with corresponding point estimates and forecast intervals at 80% and 95% confidence levels.

3. Then you decide to find a link between the identified inflows (i.e., Financial account less Reserve assets in the BoP table) and CDS (please include if you think any other variable would be useful). Using the quarterly data available at the time, you estimate simple linear regression equations (or VAR if possible) to have a preliminary estimate for inflows. How much of inflows would you expect to observe in one year?¶

In [ ]:
inflows = data %>% select("Date", "Identified Inflows", "CDS of Turkey (5yr)")

# Convert column to date format
inflows$Date = as.Date(inflows$Date)
In [ ]:
inflows_quarterly = inflows %>% filter(format(Date, "%m") %in% c("03", "06", "09", "12"))
# Perform simple linear regression
lm_model = lm(`Identified Inflows` ~ `CDS of Turkey (5yr)`, data = inflows_quarterly)
In [ ]:
summary(lm_model)

lm_model.png

In this example, we are regressing "$Identified\ Inflows$" on "$CDS\ of\ Turkey\ (5yr)$" using quarterly data. The "summary" function provides the estimated coefficients, standard errors, t-values, and p-values for the regression model.

Multiple R-squared and Adjusted R-squared: These are measures of the goodness of fit of the model. Multiple R-squared represents the proportion of variance in the dependent variable that is explained by the independent variable(s), while Adjusted $R-squared$ takes into account the number of independent variables in the model. In this case, the $Multiple\ R-squared$ is $0.1744$ and the Adjusted $R-squared$ is $0.1619$, indicating that about $17.44\%$ of the variance in Identified Inflows can be explained by $CDS\ of\ Turkey\ (5yr)$

Coefficients: These are the estimated coefficients of the linear regression model. The intercept term is estimated to be 15.408249 with a standard error of 2.191512, and the coefficient for $CDS\ of\ Turkey\ (5yr)$ is estimated to be -0.025998 with a standard error of 0.006962. The t-value and p-value are also shown, which can be used to assess the significance of the coefficients. In this case, the intercept term and $CDS\ of\ Turkey\ (5yr)$ coefficient are both statistically significant with p-values less than 0.001 and 0.01, respectively, indicating that they are likely to be different from zero.

Since the coefficient for $CDS\ of\ Turkey\ (5yr)$ is negative, this suggests that an increase in the value of the $CDS\ of\ Turkey\ (5yr)$ variable (which represents the credit default swap spread for Turkey over a 5-year period) is associated with a decrease in the Identified Inflows variable (which represents inflows). In other words, when the credit default swap spread for Turkey increases, it is likely to lead to a decrease in inflows.

1. You estimate the possible USDTRY change in one year.¶

1. You may start by linking USDTRY with CDS and/or inflows (please include if you think any other variable would be useful)¶

In [20]:
ggplot(data, aes(x = Date, y = USDTRY)) +
  geom_line(color = "blue", na.rm = TRUE) +
  labs(x = "Date", y = "USDTRY Exchange Rate", title = "USDTRY Exchange Rate Over Time")
In [28]:
# Create a scatter plot 
ggplot(data, aes(x = `Turkey CPI (%YoY)`, y = `Turkey GDP Growth (%YoY, NSA)`)) +
  geom_point(na.rm = TRUE) +
  labs(x = "Turkey CPI (%YoY)", y = "Turkey GDP Growth (%YoY, NSA)", title = "Scatter Plot of Turkey CPI vs. GDP Growth")
In [43]:
# Create a scatter plot of Turkey CPI against Turkey GDP 
ggplot(data, aes(x = `Turkey CPI (%YoY)`, y = `Turkey GDP Growth (%YoY, NSA)`)) +
  geom_point(na.rm = TRUE) +
  labs(x = "Turkey CPI (%YoY)", y = "Turkey GDP Growth (%YoY, NSA)", title = "Scatter Plot of Turkey CPI vs. GDP Growth")

# Remove rows with missing values from the data
data_clean = data[complete.cases(data), ]

# Create a bar chart of average funding rate, one-week repo rate, and ON borrowing rate with missing values removed for plotting
ggplot(data_clean, aes(x = Date, y = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`)) +
  geom_col(fill = "blue") +
  labs(x = "Date", y = "Turkey Policy Rate", title = "Average Funding Rate, One-Week Repo Rate, and ON Borrowing Rate Over Time")
In [47]:
data_filtered = data %>% 
  filter(!is.na(USDTRY) & !is.na(`CDS of Turkey (5yr)`))

# Create scatter plot
ggplot(data_filtered, aes(x = `CDS of Turkey (5yr)`, y = USDTRY)) +
  geom_point() +
  labs(x = "CDS of Turkey (5yr)", y = "USDTRY", title = "Scatter Plot of CDS vs. USDTRY") +
  theme_minimal()

# Perform linear regression
regression_model = lm(USDTRY ~ `CDS of Turkey (5yr)`, data = data_filtered)
summary(regression_model)
Call:
lm(formula = USDTRY ~ `CDS of Turkey (5yr)`, data = data_filtered)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.2475 -0.8974  0.0619  1.0620  6.7563 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)           -2.839358   0.548710  -5.175 2.32e-06 ***
`CDS of Turkey (5yr)`  0.024016   0.001743  13.777  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.996 on 66 degrees of freedom
Multiple R-squared:  0.742,	Adjusted R-squared:  0.7381 
F-statistic: 189.8 on 1 and 66 DF,  p-value: < 2.2e-16

The regression analysis results for "USDTRY" against "CDS of Turkey (5yr)" are as follows: Intercept (Intercept): Estimate = -2.839358, Std. Error = 0.548710, t-value = -5.175, p-value = 2.32e-06 (highly significant) Coefficient for "CDS of Turkey (5yr)" (CDS of Turkey (5yr)): Estimate = 0.024016, Std. Error = 0.001743, t-value = 13.777, p-value < 2e-16 (highly significant)

The R-squared value of the model is 0.742, which indicates that approximately 74.2% of the variability in "USDTRY" can be explained by the linear relationship with "CDS of Turkey (5yr)".

In [8]:
data = ts(data[, c("Date", "USDTRY", "CDS of Turkey (5yr)")], frequency = 4, start = c(2006, 1))
data = head(data, 56)
data
A Time Series: 56 × 3
DateUSDTRYCDS of Turkey (5yr)
2006 Q111411712001.3330143.966
2006 Q211491200001.4631197.459
2006 Q311570688001.4989221.261
2006 Q411649312001.4554182.813
2007 Q111727072001.4109168.769
2007 Q211806560001.3382152.005
2007 Q311886048001.2863186.107
2007 Q411964672001.1902175.513
2008 Q112043296001.2056233.730
2008 Q212122784001.2616264.107
2008 Q312202272001.2128287.686
2008 Q412280896001.5390484.089
2009 Q112358656001.6590436.488
2009 Q212438144001.5686290.382
2009 Q312517632001.4984219.885
2009 Q412596256001.4910188.671
2010 Q112674016001.5094180.187
2010 Q212753504001.5418180.981
2010 Q312832992001.5135168.900
2010 Q412911616001.4662136.576
2011 Q112989376001.5774159.336
2011 Q213068864001.5676160.331
2011 Q313148352001.7383228.136
2011 Q413226976001.8393272.135
2012 Q113305600001.7963261.790
2012 Q213385088001.8070251.891
2012 Q313464576001.8033184.495
2012 Q413543200001.7944144.172
2013 Q113620960001.7854131.605
2013 Q213700448001.8392140.814
2013 Q313779936001.9686211.426
2013 Q413858560002.0251200.302
2014 Q113936320002.2141243.708
2014 Q214015808002.1115188.236
2014 Q314095296002.1637183.400
2014 Q414173920002.2624181.410
2015 Q114251680002.4642196.705
2015 Q214331168002.6650220.213
2015 Q314410656002.8557256.919
2015 Q414489280002.9074263.932
2016 Q114567904002.9413286.035
2016 Q214647392002.8977257.893
2016 Q314726880002.9666250.135
2016 Q414805504003.2936273.265
2017 Q114883264003.6945253.462
2017 Q214962752003.5771207.918
2017 Q315042240003.5130179.286
2017 Q415120864003.8022188.091
2018 Q115198624003.8172172.171
2018 Q215278112004.3740249.399
2018 Q315357600005.6586407.471
2018 Q415436224005.4996384.537
2019 Q115513984005.3644338.686
2019 Q215593472005.8726457.103
2019 Q315672960005.6749389.385
2019 Q415751584005.7994330.440
In [11]:
lag_order <- c(2, 1) # Lag order 2 for "USDTRY" and lag order 1 for "CDS of Turkey (5yr)"
In [12]:
var_model <- VAR(data, p = max(lag_order), type = "none", lag.max = max(lag_order))
In [13]:
granger_test <- causality(var_model, cause = "CDS.of.Turkey..5yr.")
In [14]:
#  Granger causality test
granger_test = causality(var_model, cause = "CDS.of.Turkey..5yr.")
In [15]:
print(granger_test)
$Granger

	Granger causality H0: CDS.of.Turkey..5yr. do not Granger-cause Date
	USDTRY

data:  VAR object var_model
F-Test = 0.75171, df1 = 4, df2 = 144, p-value = 0.5584


$Instant

	H0: No instantaneous causality between: CDS.of.Turkey..5yr. and Date
	USDTRY

data:  VAR object var_model
Chi-squared = 18.19, df = 2, p-value = 0.0001122


In [ ]:
granger_pvalues = granger_test$Granger$p.value

#  plotting
plot_data = data.frame(Date = time(data), 
                        USDTRY = as.vector(data[, "USDTRY"]), 
                        CDS_Turkey_5yr = as.vector(data[, "CDS of Turkey (5yr)"]),
                        Granger_Pvalue = as.vector(granger_pvalues))

# time series plot
ggplot(plot_data, aes(x = USDTRY, y = CDS_Turkey_5yr)) +
  geom_point(color = "steelblue") +
  geom_text(aes(label = ifelse(Granger_Pvalue < 0.05, "*", "")), 
            vjust = -1, hjust = 4, size = 20) +
  labs(x = "USDTRY", y = "CDS of Turkey (5yr)", title = "Granger Causality Test Results") +
  theme_minimal()

Rplot02.png

This code performs a Granger causality test for the direction of causality between "CDS of Turkey (5yr)" and "USDTRY" using a Vector Autoregression (VAR) model with the specified lag orders. The results will be printed, showing the p-value for the Granger causality test, where a p-value less than a chosen significance level (e.g., 0.05) indicates evidence of Granger causality. You can modify the cause and effect parameters in the causality() function to perform Granger causality tests for different pairs of variables in your data object.

According to our on the results, the p-value for the instantaneous causality test is 0.0001122, which is less than the chosen significance level of 0.05. This suggests that there is evidence of instantaneous causality between "CDS of Turkey (5yr)" and "USDTRY" in the VAR model.

First of all, before we make an estimate for USDTRY, we can say that some indicators are in a direct relationship with USDTRY, therefore, if CDS values decrease (250bps or 300bps), we can think that a capital close to 40-50 billion dollars can enter Turkey in the 12-month term. We used the Granger Causality model to explain the relationship between CDS and USDTRY. In addition, we need to examine the policy rate that directly affects the USDTRY (For this, the upcoming elections in Turkey, statistics may be an indicator beyond the models for us.) A clear relationship between USDTRY and the policy rate is clearly seen with the past statistical models. In such a scenario, we can say that TL can appreciate by 12-15% in case the policy rate is 21-22 within a 12-month maturity.

A different perspective for market prospects¶

f1ad592a-1966-473f-b418-7c7282e759bd.jpg

2. Using your USDTRY forecast one year ahead, you try to forecast inflation in a year (you may use passthrough estimates)¶

In [30]:
data$Date = as.Date(data$Date)

ts_data = ts(data[, c("USDTRY", "Turkey 12-month ahead inflation expectations")], 
              start = min(data$Date), end = max(data$Date), frequency = 1)

plot_data = data.frame(Date = time(ts_data), 
                        USDTRY = as.vector(ts_data[, "USDTRY"]), 
                        Inflation_Expectations = as.vector(ts_data[, "Turkey 12-month ahead inflation expectations"]))

ggplot(plot_data, aes(x = USDTRY, y = Inflation_Expectations)) +
  geom_point(color = "steelblue") +
  labs(x = "USDTRY", y = "Turkey 12-month ahead Inflation Expectations", 
       title = "USDTRY vs. Turkey 12-month Ahead Inflation Expectations") +
  theme_minimal()
In [ ]:
data$Date = as.Date(data$Date)


plot_data = data.frame(Date = data$Date, 
                        USDTRY = data$USDTRY, 
                        Inflation_Expectations = data$`Turkey 12-month ahead inflation expectations`)


ggplot(plot_data, aes(x = Date)) +
  geom_line(aes(y = USDTRY, color = "USDTRY")) +
  geom_line(aes(y = Inflation_Expectations, color = "Inflation Expectations")) +
  labs(x = "Date", y = "Value", 
       title = "USDTRY vs. Turkey 12-month Ahead Inflation Expectations") +
  theme_minimal() +
  scale_color_manual(name = "Variable", 
                     values = c("USDTRY" = "steelblue", "Inflation Expectations" = "red"))

Rplot03.png

In [33]:
#regression model
model = lm(`Turkey 12-month ahead inflation expectations` ~ USDTRY, data = data)

#summary
summary(model)
Call:
lm(formula = `Turkey 12-month ahead inflation expectations` ~ 
    USDTRY, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.4213 -0.7288 -0.0833  0.3965  4.4250 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   4.1647     0.3422   12.17   <2e-16 ***
USDTRY        1.5220     0.1216   12.52   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.226 on 54 degrees of freedom
Multiple R-squared:  0.7437,	Adjusted R-squared:  0.739 
F-statistic: 156.7 on 1 and 54 DF,  p-value: < 2.2e-16

R-squared: The R-squared value is 0.7437, which means that approximately 74.37% of the variability in Turkey's 12-month ahead inflation expectations can be explained by the linear relationship with USDTRY.

I think, the linear regression analysis suggests that there is a statistically significant positive relationship between USDTRY and Turkey's 12-month ahead inflation expectations, with USDTRY being a significant predictor of inflation expectations. However, it's important to consider other factors and assumptions of linear regression when interpreting the results and making conclusions

In [ ]:
ggplot(data, aes(x = USDTRY, y = `Turkey 12-month ahead inflation expectations`)) +
  geom_point(color = "steelblue") +
  geom_smooth(method = "lm", se = FALSE, color = "red", linetype = "solid", linewidth = 1) +
  labs(x = "USDTRY", y = "Turkey 12-month ahead Inflation Expectations", 
       title = "USDTRY vs. Turkey 12-month Ahead Inflation Expectations (Linear Regression)") +
  theme_minimal()

Rplot04.png

According to on the our linear regression analysis of USDTRY and Turkey's 12-month ahead inflation expectations, the following observations can we have:¶

Positive correlation, we can say that the scatter plot and the positive slope of the regression line suggest that there may be a positive linear relationship between USDTRY and inflation expectations. This means that as USDTRY increases, inflation expectations tend to increase as well.

We have seen that the relationship between these variables is clear so that we can forecast inflation, and now a 12-month inflation expectation statement can be made with a comment on the future value of the USDTRY for a future inflation forecast. Therefore, we need to analyze the situation of the factors that directly affect USDTRY (such as CDS, policy rate). It can be clearly interpreted that it will rise with orthodox policies. Therefore, in summary, assuming that CDS will stay the same and the policy rate will stay the same or decrease, USDTRY will depreciate at least 10-15% in a 12-month period. In this case, the effect on inflation will be negative. As we can see in the charts and our analysis, it is clear that there is a positive correlation with USDTRY and inflation expectation (or inflation itself). If CDS experiences a decrease of 250-300bps (which depends on the policy rate). We can see a positive trend of 12-15% in USDTRY in a 12-month period. Of course, we can provide an empirical proof of this (I don't think so, regression analysis and graphs show this clearly).

Finally, using your policy rate and CDS assumptions (what other variables could be useful), you estimate the shock that could be observed on GDP growth in one year.¶

In [ ]:
data$Date = as.Date(data$Date)

#USDTRY
plot_usdtry = ggplot(data, aes(x = Date, y = USDTRY)) +
  geom_line(color = "steelblue") +
  labs(x = "Date", y = "USDTRY", title = "USDTRY") +
  theme_minimal()

# CDS
plot_cds_turkey = ggplot(data, aes(x = Date, y = `CDS of Turkey (5yr)`)) +
  geom_line(color = "red") +
  labs(x = "Date", y = "CDS of Turkey (5yr)", title = "CDS of Turkey (5yr)") +
  theme_minimal()

# Policy Rate
plot_policy_rate = ggplot(data, aes(x = Date, y = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`)) +
  geom_line(color = "green") +
  labs(x = "Date", y = "Turkey Policy Rate", title = "Turkey Policy Rate") +
  theme_minimal()


grid.arrange(plot_usdtry, plot_cds_turkey, plot_policy_rate, ncol = 1)

d7eaed7a-908d-4085-ac1f-25680ebc4ee1.png

Looking at the historical analysis, our graph clearly shows the correlation.

In [43]:
usdtry = data$USDTRY
cds = data$`CDS of Turkey (5yr)`
policy_rate = data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate  and ON borrowing rate)`
gdp_growth = data$`Turkey GDP Growth (%YoY, NSA)`

usdtry_stats = summary(usdtry)
cds_stats = summary(cds)
policy_rate_stats = summary(policy_rate)
gdp_growth_stats = summary(gdp_growth)

correlation = cor(data.frame(USDTRY = usdtry, CDS = cds, Policy_Rate = policy_rate, GDP_Growth = gdp_growth))

cat("USDTRY Descriptive Statistics:\n")
print(usdtry_stats)

cat("\nCDS of Turkey (5yr) Descriptive Statistics:\n")
print(cds_stats)

cat("\nTurkey Policy Rate Descriptive Statistics:\n")
print(policy_rate_stats)

cat("\nTurkey GDP Growth Descriptive Statistics:\n")
print(gdp_growth_stats)

cat("\nCorrelation Coefficients:\n")
corrplot(correlation, method = "number")
USDTRY Descriptive Statistics:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  1.190   1.507   1.823   2.471   2.948   5.873 

CDS of Turkey (5yr) Descriptive Statistics:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  131.6   180.8   215.7   235.8   264.0   484.1 

Turkey Policy Rate Descriptive Statistics:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  5.120   7.015   9.225  11.408  15.435  24.340 

Turkey GDP Growth Descriptive Statistics:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-14.540   3.165   5.635   4.795   7.713  11.800 

Correlation Coefficients:

According to this analysis a positive correlation between two variables means that as one variable increases, the other tends to increase as well. A correlation coefficient close to 1 indicates a strong positive correlation, while a value closer to 0 indicates a weaker positive correlation.

What would be a desirable level of interest rate that would create a suitable environment to lower inflation towards target while also bringing growth in line with Turkey’s potential?¶

All our statistical analyzes and graphs show a correlation between variables. Therefore, we need to analyze the relationships between correlations well and explain the reasons for a policy rate or an inflation that will provide an appropriate growth.

So, with the analysis that we are doing right now and when we analyze the current situation of the country, we need inflation to come down in order to provide the appropriate growth environment, we need 250-300bps CDS points to come down for that, we need an increase in the policy rate for that to come down. Therefore, we can say that the policy rate could be around 20% within 12 months, in line with market expectations. If the policy rate is 20%, there could be a drop of about 250-300bps in the CDS, which means that the TL could appreciate by 15% from the top with foreign capital. The effect of all of these would be to reduce inflation and the GDP Growth Rate would rise and a favorable growth could be achieved. (We can say that the upcoming elections in Turkey will directly affect this and the policy rate will increase in a possible election and change of government. also, a 12-month forecast can be made with the values we mentioned.)

If the opposite happens and the policy rate stays the same or declines, the opposite scenario will occur and it will be difficult to achieve a favorable growth environment in 12 months. Also, the CDS and other parameters like inflation will be negatively affected.

More parameters can be added to the ones we have mentioned and their correlations can be analyzed by regression or other statistical methods. But for this study I did not need to go any further, the parameters I have discussed are sufficient to answer your questions.

  • gokkaya[thiswebsite]
  • ahmetmahmutgokkaya
  • Profile Icon ahmetmahmutgokkaya
  • ahmetmahmutgokkaya